package com.book.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.book.entity.Book;

/**
 * @author Administrator
 *
 */
@Repository
public class BookDao {
	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	public void saveBook(Book book) {
		String sql = "insert into t_book(id, bookname, price, publish) values(S_BOOK_ID.nextval, ?, ?, ?)";
		Object[] args = {book.getBookname(), book.getPrice(), book.getPublish()};
		jdbcTemplate.update(sql, args);
	}
}
